import sys
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QHBoxLayout, QFormLayout
from PyQt5.QtWidgets import (
    QPushButton,
    QLineEdit,
    QTextEdit,
    QMessageBox,
    QInputDialog,
)


def delete_click():
    text, confirm = QInputDialog.getText(w, "请输入内容", "请输入小于10个字符的内容")
    print("result：", text, confirm)


if __name__ == "__main__":
    # 1. 创建应用程序
    app = QApplication(sys.argv)

    # 2. 创建窗口
    w = QWidget()
    # 创建标题
    w.setWindowTitle("输入对话框")
    # w.resize(400, 300)

    # 创建垂直布局：vertical；创建水平布局：horizon
    root_layout = QHBoxLayout(w)
    button = QPushButton("创建用户")
    root_layout.addWidget(button)
    button.clicked.connect(delete_click)

    w.setLayout(root_layout)

    # 3. 显示窗口
    w.show()

    # 4. 等待APP停止
    sys.exit(app.exec_())
